package com.abxh.jetpack.net;

import android.net.NetworkInfo;

import androidx.annotation.RequiresPermission;

import static android.Manifest.permission.ACCESS_NETWORK_STATE;

/**
 * Created by dab on 2021/10/14 11:52
 */

public class NetworkUtils {
    @RequiresPermission(ACCESS_NETWORK_STATE)
    private static NetworkInfo getActiveNetworkInfo() {
//        ConnectivityManager cm = (ConnectivityManager) DGGUtils.getApp().getSystemService(Context.CONNECTIVITY_SERVICE);
//        if (cm == null) return null;
//        return cm.getActiveNetworkInfo();
        return null;
    }
    @RequiresPermission(ACCESS_NETWORK_STATE)
    public static boolean isConnected() {
        NetworkInfo info = getActiveNetworkInfo();
        return info != null && info.isConnected();
    }
}
